package org.jivesoftware.smackx.muc;

import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.packet.MUCAdmin.Item;
import org.jivesoftware.smackx.packet.MUCUser;
import org.jivesoftware.smackx.packet.MUCUser.Item;

public class Occupant
{
  private String affiliation;
  private String jid;
  private String nick;
  private String role;

  Occupant(Presence paramPresence)
  {
    MUCUser.Item localItem = ((MUCUser)paramPresence.getExtension("x", "http://jabber.org/protocol/muc#user")).getItem();
    this.jid = localItem.getJid();
    this.affiliation = localItem.getAffiliation();
    this.role = localItem.getRole();
    this.nick = StringUtils.parseResource(paramPresence.getFrom());
  }

  Occupant(MUCAdmin.Item paramItem)
  {
    this.jid = paramItem.getJid();
    this.affiliation = paramItem.getAffiliation();
    this.role = paramItem.getRole();
    this.nick = paramItem.getNick();
  }

  public boolean equals(Object paramObject)
  {
    boolean bool;
    if (!(paramObject instanceof Occupant))
      bool = false;
    while (true)
    {
      return bool;
      Occupant localOccupant = (Occupant)paramObject;
      bool = this.jid.equals(localOccupant.jid);
    }
  }

  public String getAffiliation()
  {
    return this.affiliation;
  }

  public String getJid()
  {
    return this.jid;
  }

  public String getNick()
  {
    return this.nick;
  }

  public String getRole()
  {
    return this.role;
  }

  public int hashCode()
  {
    int j;
    int i = 17 * (17 * (17 * this.affiliation.hashCode() + this.role.hashCode()) + this.jid.hashCode());
    if (this.nick != null)
      j = this.nick.hashCode();
    while (true)
    {
      return (i + j);
      j = 0;
    }
  }
}